import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f','--file',dest='file',type=str,default='e203_nice_core.v')

args = parser.parse_args()
file_data = ""
remove = 0
with open(args.file,"r",encoding="utf-8") as f:
    for line in f:
        if(line[1:3]=="if" or line[0:7]=="initial"):
            remove += 1
            temp = ""
        elif(line[1:4]=="end" or line[0:6]=="end //"):
            remove -= 1
            temp = ""
        else:
            if(remove!=0):
                temp=""
            else:
                temp = line.split('/')[0]
                if((len(temp)!=0) and (temp[-1]!='\n')) :
                	temp += '\n'
        file_data += temp
with open(args.file,"w",encoding= "utf-8") as f:
    f.write(file_data)
    
    #args.file
